home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) scales.c 12.1 95/07/05 SCOINC
- */
- /***************************************************************************
- *
- * Copyright (c) 1990-1993 The Santa Cruz Operation, Inc.
- *
- * All rights reserved. No part of this program or publication may be
- * reproduced, transmitted, transcribed, stored in a retrieval system,
- * or translated into any language or computer language, in any form or
- * by any means, electronic, mechanical, magnetic, optical, chemical,
- * biological, or otherwise, without the prior written permission of:
- *
- * The Santa Cruz Operation , Inc. (408) 425-7222
- * 400 Encinal St., Santa Cruz, California 95060 USA
- *
- **************************************************************************/
- /*
- * Modification History
- *
- * S002, 27-May-93, rickra
- * Added support for pixmaps
- *
- * S001, 01-Jan-93, rickra
- * Added support for seperate windows.
- * Added MEM scale routines....
- *
- * S000, 30-Sep-92, rickra
- * Added copyright and modification history
- * Change hard coded color referneces to user configurable.
- */
- /*+-------------------------------------------------------------------------
- scales.c - XSW CPU and wait percentage scale handler
- wht@n4hgf.Mt-Park.GA.US
-
- Defined functions:
- draw_CpuScale_literals(x,y)
- draw_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- draw_WaitScale_literals(x,y)
- update_CpuScale(x,y,per_state)
- update_PctScale(x,y,length,label,totalC,greenC,yellowC,redC)
- update_WaitScale(x,y,per_state,total_ticks)
-
- --------------------------------------------------------------------------*/
- /*+:EDITS:*/
- /*:09-26-1990-00:28-wht@n4hgf-new scale bar labelling */
- /*:09-25-1990-05:11-wht@n4hgf-release heh-heh x0.22 preliminary */
- /*:09-20-1990-00:09-wht@n4hgf-scales, sysinfo/minfo, bootinfo working */
- /*:09-15-1990-14:47-wht-creation */
-
- #include "include/unixincs.h"
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/Intrinsic.h>
- #include <X11/Shell.h>
- #include <X11/StringDefs.h>
- #include <Xm/Xm.h>
- #include <Xm/MainW.h>
- #include <Xm/DrawingA.h>
-
- #include "include/buttons.h"
- #include "include/resources.h"
- #include "include/scales.h"
- #include "include/xsw.h"
-
- extern struct NetworkXswStruct *current_server;
-
-
- /*+-------------------------------------------------------------------------
- draw_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_PctScale_literals1 (window, display, gc, DrawAreaXYWH, x, y, pixmap, scale_name, val1_name, val2_name, val3_name)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- int x;
- int y;
- Pixmap pixmap;
- char *scale_name;
- char *val1_name;
- char *val2_name;
- char *val3_name;
- {
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2);
- int yl2 = y + (FHEIGHT / 2) - 1;
- int len;
- char *cptr;
- char s80[80];
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_PctScale_literals\n");
- #endif
-
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, FHEIGHT - 1,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl2,
- DisplayWidth(display,screen), yl2);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl2,
- DisplayWidth (display, screen), yl2);
-
-
-
-
- /* -----CPU ----tot usr ker brk-------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- */
-
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
-
-
-
- x2 += len;
-
- sprintf (s80, "%-4.4s", scale_name);
- cptr = s80;
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
-
-
-
-
- x2 += FWIDTH * len;
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- /*
- XDrawLine (display, window, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 4)) - FGAP, yl1);
- */
-
- XDrawLine (display, pixmap, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 4)) - FGAP, yl1);
-
-
-
- x2 += len;
-
- current_server -> PctScale_xoffset = x2 - x;
- sprintf (s80, "tot %s %s %s ", val1_name, val2_name, val3_name);
- cptr = s80;
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
-
-
-
- x2 += FWIDTH * len;
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- DisplayWidth(display,screen), yl1);
- */
-
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- DisplayWidth (display, screen), yl1);
-
-
- current_server -> PctScale_width = DrawAreaXYWH.width - BORDER_EXTRA_WIDTH - x2;
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- /* per scale labels */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 13, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 1), FWIDTH * 13, FHEIGHT);
-
-
- if ((current_server -> StatCycle_msec >= 100) && (current_server -> StatCycle_msec < 1000L))
- {
- sprintf (s80, "%3d Ms Avg%% ", (int) (current_server -> StatCycle_msec));
- cptr = s80;
- }
- else
- {
- sprintf (s80, " %2d Sec Avg%% ", (int) (current_server -> StatCycle_msec / 1000L));
- cptr = s80;
- }
-
-
- XSetForeground (display, gc, colorLabel.pixel);
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- */
-
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
-
-
-
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 13, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 13, FHEIGHT);
-
-
-
- cptr = s80;
- if (current_server -> StatCycle_msec == 100)
- {
- sprintf (s80, "%3d Ms Avg%% ", (int) (current_server -> StatCycle_msec * 5));
- cptr = s80;
- }
- else
- {
- sprintf (s80, " %2d Sec Avg%% ", (int) ((current_server -> StatCycle_msec * 5) / 1000L));
- cptr = s80;
- }
-
- XSetForeground (display, gc, colorLabel.pixel);
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
-
-
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 3), FWIDTH * 13, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 3), FWIDTH * 13, FHEIGHT);
-
-
-
-
- sprintf (s80, " %2d Sec Avg%% ",
- (int) ((current_server -> StatCycle_msec * 10) / 1000L));
- cptr = s80;
-
- XSetForeground (display, gc, colorLabel.pixel);
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
- */
-
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
-
-
-
-
- } /* end of draw_PctScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_PctScale_literals (x, y, scale_name, val1_name, val2_name, val3_name)
- int x;
- int y;
- char *scale_name;
- char *val1_name;
- char *val2_name;
- char *val3_name;
- {
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2);
- int yl2 = y + (FHEIGHT / 2) - 1;
- int len;
- char *cptr;
- char s80[80];
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_PctScale_literals\n");
- #endif
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, FHEIGHT - 1,
- line_style, cap_style, join_style);
- XDrawLine (display, window, gc,
- x2, yl2,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl2);
-
- /* -----CPU ----tot usr ker brk-------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- x2 += len;
-
- sprintf (s80, "%-4.4s", scale_name);
- cptr = s80;
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
-
- XDrawLine (display, window, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 4)) - FGAP, yl1);
- x2 += len;
-
- current_server -> PctScale_xoffset = x2 - x;
- sprintf (s80, "tot %s %s %s ", val1_name, val2_name, val3_name);
- cptr = s80;
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
-
- XDrawLine (display, window, gc,
- x2, yl1,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl1);
-
- current_server -> PctScale_width = DrawAreaXYWH.width - BORDER_EXTRA_WIDTH - x2;
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- /* per scale labels */
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 13, FHEIGHT, 0);
- if ((current_server -> StatCycle_msec >= 100) && (current_server -> StatCycle_msec < 1000L))
- {
- sprintf (s80, "%3d Ms Avg%% ", (int) (current_server -> StatCycle_msec));
- cptr = s80;
- }
- else
- {
- sprintf (s80, " %2d Sec Avg%% ", (int) (current_server -> StatCycle_msec / 1000L));
- cptr = s80;
- }
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
-
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 13, FHEIGHT, 0);
- cptr = s80;
- if (current_server -> StatCycle_msec == 100)
- {
- sprintf (s80, "%3d Ms Avg%% ", (int) (current_server -> StatCycle_msec * 5));
- cptr = s80;
- }
- else
- {
- sprintf (s80, " %2d Sec Avg%% ", (int) ((current_server -> StatCycle_msec * 5) / 1000L));
- cptr = s80;
- }
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
-
- XClearArea (display, window, x, y + (FHEIGHT * 3), FWIDTH * 13, FHEIGHT, 0);
- sprintf (s80, " %2d Sec Avg%% ", (int) ((current_server -> StatCycle_msec * 10) / 1000L));
- cptr = s80;
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
-
- } /* end of draw_PctScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_CpuScale_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_CpuScale_literals (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap;
-
- int x = 0;
- int y = 0;
-
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_CpuScale_literals\n");
- #endif
- draw_PctScale_literals1 (window, display, gc, DrawAreaXYWH, x, y, pixmap, "CPU", "usr", "ker", "brk");
- } /* end of draw_CpuScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_WaitScale_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_WaitScale_literals (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap;
-
- int x = 0;
- int y = 0;
-
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_WaitScale_literals\n");
- #endif
-
- draw_PctScale_literals1 (window, display, gc, DrawAreaXYWH, x, y, pixmap, "Wait", " io", "pio", "swp");
- } /* end of draw_WaitScale_literals */
-
- /*+-------------------------------------------------------------------------
- update_PctScale(x,y,scale_length,totalC,bar1,bar2,bar3)
- --------------------------------------------------------------------------*/
- void
- update_PctScale (window, display, gc, x, y, scale_length, pixmap, label, totalC, bar1, bar2, bar3, pixel1, pixel2, pixel3)
- Window window;
- Display *display;
- GC gc;
- int x, y, scale_length;
- Pixmap pixmap;
- char *label;
- unsigned long totalC;
- unsigned long bar1;
- unsigned long bar2;
- unsigned long bar3;
- XColor pixel1;
- XColor pixel2;
- XColor pixel3;
-
- {
-
- int yl = y + (FHEIGHT / 2) - 1; /* y for lines */
- int ys = y + FASCENT; /* y for strings */
- int line_length;
- int used_length = 0;
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In update_PctScale\n");
- #endif
-
-
- /*
- XClearArea (display, window, x, y - 1, scale_length, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y - 1, scale_length, FHEIGHT);
-
-
-
- if (scale_length < 6)
- return;
-
- if (totalC < (bar1 + bar2 + bar3))
- totalC = bar1 + bar2 + bar3;
-
- /*
- * Proctect against division by ZERO
- */
-
- if (totalC == 0)
- totalC = 1;
-
- XSetLineAttributes (display, gc, FHEIGHT, line_style, cap_style, join_style);
-
- if (line_length = (int) (((float) bar1 * scale_length) / (float) totalC))
- {
- XSetForeground (display, gc, pixel1.pixel);
- /*
- XDrawLine (display, window, gc, x, yl, x + line_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + line_length, yl);
- if (line_length > FWIDTH)
- {
- XSetForeground (display, gc, background);
- /*
- XDrawString (display, window, gc, x, ys, label + 0, 1);
- XDrawString (display, window, gc, x + 1, ys, label + 0, 1);
- */
-
- XDrawString (display, pixmap, gc, x, ys, label + 0, 1);
- XDrawString (display, pixmap, gc, x + 1, ys, label + 0, 1);
- }
- used_length += line_length;
- x += line_length;
- }
-
- if (line_length = (int) (((float) bar2 * scale_length) / (float) totalC))
- {
- XSetForeground (display, gc, pixel2.pixel);
- /*
- XDrawLine (display, window, gc, x, yl, x + line_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + line_length, yl);
- if (line_length > FWIDTH)
- {
- XSetForeground (display, gc, /* ColorBlack.pixel */ background);
- /*
- XDrawString (display, window, gc, x, ys, label + 1, 1);
- XDrawString (display, window, gc, x + 1, ys, label + 1, 1);
- */
-
- XDrawString (display, pixmap, gc, x, ys, label + 1, 1);
- XDrawString (display, pixmap, gc, x + 1, ys, label + 1, 1);
- }
- used_length += line_length;
- x += line_length;
- }
-
- if (line_length = (int) (((float) bar3 * scale_length) / (float) totalC))
- {
- XSetForeground (display, gc, pixel3.pixel);
- /*
- XDrawLine (display, window, gc, x, yl, x + line_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + line_length, yl);
- if (line_length > FWIDTH)
- {
- XSetForeground (display, gc, background);
- /*
- XDrawString (display, window, gc, x, ys, label + 2, 1);
- XDrawString (display, window, gc, x + 1, ys, label + 2, 1);
- */
-
- XDrawString (display, pixmap, gc, x, ys, label + 2, 1);
- XDrawString (display, pixmap, gc, x + 1, ys, label + 2, 1);
- }
- used_length += line_length;
- x += line_length;
- }
-
- if ((scale_length - used_length) > 0)
- {
- /*
- XSetForeground (display, gc, background);
- XDrawLine (display, window, gc, x + used_length, yl, x + scale_length, yl);
- */
- }
-
- } /* end of update_PctScale */
-
- /*+-------------------------------------------------------------------------
- update_CpuScale(x,y,per_state)
-
- 000000000011111111112222222222333333333344444444445555555555666666
- 012345678901234567890123456789012345678901234567890123456789012345
- tot usr ker brk
- ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- extern struct NetworkXswStruct *current_server;
- --------------------------------------------------------------------------*/
- #define _CPUSCALE_TX (FWIDTH * 0)
- #define _CPUSCALE_UX (FWIDTH * 4)
- #define _CPUSCALE_KX (FWIDTH * 8)
- #define _CPUSCALE_BX (FWIDTH * 12)
- #define _CPUSCALE_SX (FWIDTH * 16)
-
- time_t
- update_CpuScale (SP, x, y, per_state)
- struct NetworkXswStruct *SP;
- int x;
- int y;
- time_t *per_state;
- {
-
- Widget shell_widget = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].shell_widget;
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].pixmap;
-
-
- time_t idle = per_state[CPU_IDLE] + per_state[CPU_WAIT];
- time_t cpu_ticks_total = idle + per_state[CPU_SXBRK] +
- per_state[CPU_KERNEL] + per_state[CPU_USER];
- unsigned long pixel;
- char numstr[8];
- Arg args[32];
- int argcount;
-
-
- int current_width, current_height;
-
- time_t percent_user = 0;
- time_t percent_kernel = 0;
- time_t percent_break = 0;
- time_t percent_busy = 0;
-
- if (cpu_ticks_total > 0)
- {
- percent_user = (per_state[CPU_USER] * 100) / cpu_ticks_total;
- percent_kernel = (per_state[CPU_KERNEL] * 100) / cpu_ticks_total;
- percent_break = (per_state[CPU_SXBRK] * 100) / cpu_ticks_total;
- }
-
- percent_busy = percent_user + percent_kernel + percent_break;
-
-
- x += current_server -> PctScale_xoffset;
-
-
-
-
- /*
- * Clear the area for a new re-draw....
- */
-
- /*
- XClearArea (display, window, x, y, FWIDTH * 16, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y, FWIDTH * 16, FHEIGHT);
-
- #if 0
- if (!idle) /* take care of integer div truncation */
- percent_busy = 100;
- #endif
-
- if (percent_busy > res.busyAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (percent_busy > res.busyWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
-
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%3ld", percent_busy);
- /*
- XDrawString (display, window, gc,
- x + _CPUSCALE_TX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _CPUSCALE_TX, y + FASCENT, numstr, 3);
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- sprintf (numstr, "%3ld", percent_user);
- /*
- XDrawString (display, window, gc,
- x + _CPUSCALE_UX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _CPUSCALE_UX, y + FASCENT, numstr, 3);
-
- sprintf (numstr, "%3ld", percent_kernel);
- /*
- XDrawString (display, window, gc,
- x + _CPUSCALE_KX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _CPUSCALE_KX, y + FASCENT, numstr, 3);
-
- if (percent_break > res.breakAlarmThreshhold)
- XSetForeground (display, gc, colorNumericAlarm.pixel);
- else if (percent_break > res.breakWarningThreshhold)
- XSetForeground (display, gc, colorNumericWarning.pixel);
-
- sprintf (numstr, "%3ld", percent_break);
- /*
- XDrawString (display, window, gc,
- x + _CPUSCALE_BX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _CPUSCALE_BX, y + FASCENT, numstr, 3);
-
-
- /*
- * We need to draw the scale to the viewing port, Thus we need to find
- * the "current" width of the shell widget.....
- *
- * Perhaps, when we create the pixmap to the actual size needed, we can
- * look at the Drawing Areaing Width,Height parameters......
- */
-
- current_width = current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cpu].width;
-
- update_PctScale (window, display, gc, x + _CPUSCALE_SX, y,
- current_width - (x + _CPUSCALE_SX),
- pixmap,
- "ukb", 100,
- percent_user, percent_kernel, percent_break,
- colorUser, colorKernel, colorBreak);
-
-
- #ifdef DEBUG2
- fprintf (stdout, "leaving update_CpuScale\n");
- #endif
-
- return (cpu_ticks_total);
-
- } /* end of update_CpuScale */
-
- /*+-------------------------------------------------------------------------
- update_WaitScale(x,y,per_state,total_ticks)
-
- 000000000011111111112222222222333333333344444444445555555555666666
- 012345678901234567890123456789012345678901234567890123456789012345
- tot io pio swp
- ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- --------------------------------------------------------------------------*/
- #define _WAITSCALE_TX (FWIDTH * 0)
- #define _WAITSCALE_IX (FWIDTH * 4)
- #define _WAITSCALE_PX (FWIDTH * 8)
- #define _WAITSCALE_WX (FWIDTH * 12)
- #define _WAITSCALE_SX (FWIDTH * 16)
-
- void
- update_WaitScale (SP, x, y, total_ticks)
- struct NetworkXswStruct *SP;
- int x;
- int y;
- time_t total_ticks;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].gc;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].pixmap;
- XWindowAttributes DrawAreaXYWH =
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_wait].DrawAreaXYWH;
-
- time_t *per_state = SP -> wait_ticks;
-
- int current_width, current_height;
-
-
- int accum = 0;
- time_t percent_io = 0L;
- time_t percent_swap = 0L;
- time_t percent_pio = 0L;
- time_t percent_total_wait;
- time_t total_wait;
- unsigned long pixel;
- char numstr[8];
-
-
- x += current_server -> PctScale_xoffset;
-
- /* crock: because of latency, total_ticks < all wait ticks sometimes */
- total_wait = per_state[W_IO] + per_state[W_SWAP] + per_state[W_PIO];
- if (total_ticks < total_wait)
- total_ticks = total_wait;
-
- if (total_ticks)
- {
- percent_io = (per_state[W_IO] * 100) / total_ticks;
- percent_pio = (per_state[W_PIO] * 100) / total_ticks;
- percent_swap = (per_state[W_SWAP] * 100) / total_ticks;
- }
- percent_total_wait = percent_io + percent_swap + percent_pio;
- /*
- XClearArea (display, window, x, y, FWIDTH * 16, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y, FWIDTH * 16, FHEIGHT);
-
-
- if (percent_total_wait > res.waitAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (percent_total_wait > res.waitWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%3ld", percent_total_wait);
- /*
- XDrawString (display, window, gc,
- x + _WAITSCALE_TX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _WAITSCALE_TX, y + FASCENT, numstr, 3);
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- sprintf (numstr, "%3ld", percent_io);
- /*
- XDrawString (display, window, gc,
- x + _WAITSCALE_IX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _WAITSCALE_IX, y + FASCENT, numstr, 3);
-
- sprintf (numstr, "%3ld", percent_pio);
- /*
- XDrawString (display, window, gc,
- x + _WAITSCALE_PX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _WAITSCALE_PX, y + FASCENT, numstr, 3);
-
- if (percent_swap > res.swapAlarmThreshhold)
- XSetForeground (display, gc, colorNumericAlarm.pixel);
- else if (percent_swap > res.swapWarningThreshhold)
- XSetForeground (display, gc, colorNumericWarning.pixel);
-
- sprintf (numstr, "%3ld", percent_swap);
- /*
- XDrawString (display, window, gc,
- x + _WAITSCALE_WX, y + FASCENT, numstr, 3);
- */
- XDrawString (display, pixmap, gc,
- x + _WAITSCALE_WX, y + FASCENT, numstr, 3);
- current_width = current_server -> SEPERATE_WINDOWS_LIST[BUTTON_wait].width;
-
-
- update_PctScale (window, display, gc, x + _WAITSCALE_SX, y,
- current_width - (x + _WAITSCALE_SX),
- pixmap,
- "ips", 100,
- percent_io, percent_pio, percent_swap,
- colorIo, colorPio, colorSwap);
-
- } /* end of update_WaitScale */
-
-
- /*+-------------------------------------------------------------------------
- draw_Single_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_Single_PctScale_literals (window, display, gc, DrawAreaXYWH, pixmap, x, y, scale_name, val1_name, val2_name, val3_name)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- Pixmap pixmap;
-
- int x;
- int y;
- char *scale_name;
- char *val1_name;
- char *val2_name;
- char *val3_name;
- {
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2);
- int yl2 = y + (FHEIGHT / 2) - 1;
- int len;
- char *cptr;
- char s80[80];
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_Single_PctScale_literals\n");
- #endif
-
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, FHEIGHT - 1,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl2,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl2);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl2,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - BORDER_EXTRA_WIDTH, yl2);
-
- /* -----Other---cnfg max curr-------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- x2 += len;
-
- sprintf (s80, "%-5.5s", scale_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
-
- /*
- XDrawLine (display, window, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 3)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 3)) - FGAP, yl1);
- x2 += len;
-
- current_server -> PctScale_xoffset = x2 - x;
- sprintf (s80, " %s %s %s ", val1_name, val2_name, val3_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
-
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - BORDER_EXTRA_WIDTH, yl1);
- current_server -> PctScale_width = current_server -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - BORDER_EXTRA_WIDTH - x2;
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- /* Need to change this , I.e. make into a function ?? */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " NFILES ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " NINODES ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 3), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 3), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " NPROCS ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 4), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 4), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " NREGIONS ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 4) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 4) + FASCENT,
- cptr, strlen (cptr));
-
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 5), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 5), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " CBLOCKS ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 5) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 5) + FASCENT,
- cptr, strlen (cptr));
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 6), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 6), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " CALLOUTS ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 6) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 6) + FASCENT,
- cptr, strlen (cptr));
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 7), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 7), FWIDTH * 12, FHEIGHT);
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " NMOUNTS ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 7) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 7) + FASCENT,
- cptr, strlen (cptr));
- } /* end of draw_Single_PctScale_literals */
-
-
- /*+-------------------------------------------------------------------------
- draw_Mem_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_Mem_PctScale_literals (window, display, gc, DrawAreaXYWH, pixmap, x, y, scale_name, val1_name, val2_name)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- Pixmap pixmap;
- int x;
- int y;
- char *scale_name;
- char *val1_name;
- char *val2_name;
- {
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2);
- int yl2 = y + (FHEIGHT / 2) - 1;
- int len;
- char *cptr;
- char s80[80];
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_Mem_PctScale_literals\n");
- #endif
-
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, FHEIGHT - 1,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl2,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl2);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl2,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width - BORDER_EXTRA_WIDTH, yl2);
-
- /* -----Cache--- max curr-------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- x2 += len;
-
- sprintf (s80, "%-6.6s", scale_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
- /*
- XDrawLine (display, window, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 8)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 8)) - FGAP, yl1);
- x2 += len;
-
- /* need to ajust PctScale_xoffset to conform to the other routiunes..... */
-
- sprintf (s80, " %s %s ", val1_name, val2_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
-
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- SP->SEPERATE_WINDOWS_LIST[BUTTON_mem].width - BORDER_EXTRA_WIDTH, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width - BORDER_EXTRA_WIDTH, yl1);
-
-
- /* Need to change this , I.e. make into a function ?? */
-
- /*
- XSetForeground (display, gc, colorLabel.pixel);
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT);
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- cptr = " % Memory Used ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT);
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- cptr = " % Swap Used ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 3), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 3), FWIDTH * 12, FHEIGHT);
-
- XSetForeground (display, gc, colorLabel.pixel);
- cptr = " % Avail. Swap Used";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 3) + FASCENT,
- cptr, strlen (cptr));
-
- } /* end of draw_Mem_PctScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_Cache_PctScale_literals(x,y,scale_name,val1_name,val2_name,val3_name)
- --------------------------------------------------------------------------*/
- void
- draw_Cache_PctScale_literals (window, display, gc, DrawAreaXYWH, x, y, pixmap, scale_name, val1_name, val2_name, val3_name)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- int x;
- int y;
- char *scale_name;
- char *val1_name;
- char *val2_name;
- char *val3_name;
- {
- int x2 = x;
- int ys = y + FASCENT;
- int yl1 = y + (FASCENT / 2);
- int yl2 = y + (FHEIGHT / 2) - 1;
- int len;
- char *cptr;
- char s80[80];
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_Cache_PctScale_literals\n");
- #endif
-
-
- /* the "background" color */
- XSetForeground (display, gc, colorTitleBarBG.pixel);
- XSetLineAttributes (display, gc, FHEIGHT - 1,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl2,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl2);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl2,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width, yl2);
-
- /* -----Cache--- max curr-------------" */
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- XSetLineAttributes (display, gc, FASCENT / 2,
- line_style, cap_style, join_style);
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- x2 + (len = (FWIDTH * 5)) - FGAP, yl1);
- x2 += len;
-
- sprintf (s80, "%-5.5s", scale_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
- /*
- XDrawLine (display, window, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 9)) - FGAP, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2 + FGAP + 1, yl1,
- x2 + (len = (FWIDTH * 9)) - FGAP, yl1);
- x2 += len;
-
- /* need to ajust PctScale_xoffset to conform to the other routiunes..... */
-
- current_server -> PctScale_xoffset = x2 - (FWIDTH * 6) - x;
- sprintf (s80, " %s %s ", val2_name, val3_name);
- cptr = s80;
- /*
- XDrawString (display, window, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, window, gc, x2 + 1, ys, cptr, len);
- */
- XDrawString (display, pixmap, gc, x2, ys, cptr, len = strlen (cptr));
- XDrawString (display, pixmap, gc, x2 + 1, ys, cptr, len);
- x2 += FWIDTH * len;
- /*
- XDrawLine (display, window, gc,
- x2, yl1,
- DrawAreaXYWH.width - BORDER_EXTRA_WIDTH, yl1);
- */
- XDrawLine (display, pixmap, gc,
- x2, yl1,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width, yl1);
-
- XSetForeground (display, gc, colorLabel.pixel);
-
- /* Need to change this , I.e. make into a function ?? */
-
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 1), FWIDTH * 12, FHEIGHT);
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- cptr = " % WRITE HIT";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 1) + FASCENT,
- cptr, strlen (cptr));
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 12, FHEIGHT);
-
- XSetForeground (display, gc, colorTitleBarFG.pixel);
- cptr = " % READ HIT ";
- /*
- XDrawString (display, window, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x, y + (FHEIGHT * 2) + FASCENT,
- cptr, strlen (cptr));
-
- } /* end of draw_Cache_PctScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_OtherScale_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_OtherScale_literals (SP)
-
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].pixmap;
-
- int x = 0;
- int y = 0;
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_OtherScale_literals\n");
- #endif
- draw_Single_PctScale_literals (window, display, gc, DrawAreaXYWH, pixmap, x, y, "Other", "cnfg", "max", "curr");
- } /* end of draw_OtherScale_literals */
-
- /*+-------------------------------------------------------------------------
- draw_CacheScale_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_CacheScale_literals (SP)
- struct NetworkXswStruct *SP;
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap;
-
- int x = 0;
- int y = 0;
-
-
- #ifdef DEBUG2
- fprintf (stdout, "In draw_CacheScale_literals\n");
- #endif
- draw_Cache_PctScale_literals (window, display, gc, DrawAreaXYWH, x, y, pixmap, "Cache", " ", "avg", "curr");
- } /* end of draw_OtherScale_literals */
-
-
- /*+-------------------------------------------------------------------------
- draw_MemScale_literals(x,y)
- --------------------------------------------------------------------------*/
- void
- draw_MemScale_literals (SP)
- struct NetworkXswStruct *SP;
- {
-
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].pixmap;
-
- int x = 0;
- int y = 0;
- #ifdef DEBUG2
- fprintf (stdout, "In draw_MemScale_literals\n");
- #endif
- draw_Mem_PctScale_literals (window, display, gc, DrawAreaXYWH, pixmap, x, y, "Memory",
- "avg", "curr");
- } /* end of draw_OtherScale_literals */
-
-
-
-
- /*+-------------------------------------------------------------------------
- update_Single_PctScale(x,y,scale_length,totalC,greenC)
- --------------------------------------------------------------------------*/
- void
- update_Single_PctScale (window, display, gc, DrawAreaXYWH, pixmap, x, y, scale_length, label, totalC, greenC, pixel)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- Pixmap pixmap;
- int x, y, scale_length;
- char *label;
- long totalC;
- long greenC;
- unsigned long pixel;
- {
- int yl = y + (FHEIGHT / 2) - 1; /* y for lines */
- int ys = y + FASCENT; /* y for strings */
- int line_length;
- int used_length = 0;
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
- #ifdef DEBUG2
- fprintf (stdout, "In update_Single_PctScale\n");
- #endif
- /*
- XClearArea (display, window, x, y - 1, scale_length, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y - 1, scale_length, FHEIGHT);
-
- if (scale_length < 6)
- return;
-
- XSetLineAttributes (display, gc, FHEIGHT, line_style, cap_style, join_style);
-
- /*
- * Protect againts divsion by ZERO....
- */
-
- if (totalC == 0)
- totalC = 1;
-
- if (line_length = (int) (((float) greenC * scale_length) / (float) totalC))
- {
- XSetForeground (display, gc, pixel);
- /*
- XDrawLine (display, window, gc, x, yl, x + line_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + line_length, yl);
- if (line_length > FWIDTH)
- {
- /*
- XSetForeground (display, gc, background);
- */
- /*
- XDrawString (display, window, gc, x, ys, label + 0, 1);
- XDrawString (display, window, gc, x + 1, ys, label + 0, 1);
- */
- XDrawString (display, pixmap, gc, x, ys, label + 0, 1);
- XDrawString (display, pixmap, gc, x + 1, ys, label + 0, 1);
- }
- used_length += line_length;
- x += line_length;
- }
-
- if ((scale_length - used_length) > 0)
- {
- /*
- XSetForeground (display, gc, background);
- XDrawLine (display, window, gc, x + used_length, yl, x + scale_length, yl);
- */
- }
-
- } /* end of update_PctScale */
-
- /*+-------------------------------------------------------------------------
- update_Cache_PctScale(x,y,scale_length,totalC,greenC)
- --------------------------------------------------------------------------*/
- void
- update_Cache_PctScale (window, display, gc, DrawAreaXYWH, x, y, scale_length, label, totalC, pixmap, greenC, pixel, pixel2)
- Window window;
- Display *display;
- GC gc;
- XWindowAttributes DrawAreaXYWH;
- int x, y, scale_length;
- char *label;
- long totalC;
- Pixmap pixmap;
- long greenC;
- unsigned long pixel;
- unsigned long pixel2;
- {
- int yl = y + (FHEIGHT / 2) - 1; /* y for lines */
- int ys = y + FASCENT; /* y for strings */
- int line_length;
- int used_length = 0;
- int line_style = LineSolid;
- int cap_style = CapButt;
- int join_style = JoinMiter;
- #ifdef DEBUG2
- fprintf (stdout, "In update_Cache_PctScale\n");
- #endif
- /*
- XClearArea (display, window, x, y - 1, scale_length, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y - 1, scale_length, FHEIGHT);
-
- if (scale_length < 6)
- return;
-
- XSetLineAttributes (display, gc, FHEIGHT, line_style, cap_style, join_style);
- /*
- * Protect againts divsion by ZERO....
- */
-
- if (totalC == 0)
- totalC = 1;
-
- if (line_length = (int) (((float) greenC * scale_length) / (float) totalC))
- {
- XSetForeground (display, gc, pixel);
- /*
- XDrawLine (display, window, gc, x, yl, x + line_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + line_length, yl);
- if (line_length > FWIDTH)
- {
- XSetForeground (display, gc, background);
- /*
- XDrawString (display, window, gc, x, ys, label + 0, 1);
- XDrawString (display, window, gc, x + 1, ys, label + 0, 1);
- */
- XDrawString (display, pixmap, gc, x, ys, label + 0, 1);
- XDrawString (display, pixmap, gc, x + 1, ys, label + 0, 1);
- }
- used_length += line_length;
- x += line_length;
- }
-
- if ((scale_length - used_length) > 0)
- {
- XSetForeground (display, gc, pixel2);
- /*
- XDrawLine (display, window, gc, x, yl, x + scale_length, yl);
- */
- XDrawLine (display, pixmap, gc, x, yl, x + scale_length, yl);
- }
-
- } /* end of update_PctScale */
-
- /*+-------------------------------------------------------------------------
- update_FilesScale(x,y)
-
- 000000000011111111112222222222333333333344444444445555555555666666
- 012345678901234567890123456789012345678901234567890123456789012345
- cnfg max curr
- #### #### #### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap;
-
- int x = 0;
- int y = FHEIGHT;
-
-
- --------------------------------------------------------------------------*/
- #define _FILESSCALE_CF (FWIDTH * 1)
- #define _FILESSCALE_MX (FWIDTH * 6)
- #define _FILESSCALE_CU (FWIDTH * 11)
- #define _FILESSCALE_SX (FWIDTH * 16)
-
- void
- update_FilesScale (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].pixmap;
-
- int x = 0;
- int y = FHEIGHT;
-
-
- unsigned long pixel;
- char numstr[8];
-
- int file_percent;
- int inode_percent;
- int proc_percent;
- int region_percent;
- int myclist_percent;
- int callout_percent;
- int mount_percent;
-
-
- #ifdef DEBUG2
- fprintf (stdout, "In update_FilesScale\n");
- #endif
- x += current_server -> PctScale_xoffset;
-
- /*
- XClearArea (display, window, x, y, FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y, FWIDTH * 16, FHEIGHT);
-
-
-
- if (current_server -> file_count > current_server -> file_max)
- {
- current_server -> file_max = current_server -> file_count;
- }
-
- file_percent = (current_server -> file_count * 100) / current_server -> my_v -> v_file;
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_file);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT, numstr, 4);
-
- if (((current_server -> file_max * 100) / current_server -> my_v -> v_file) > res.nfileAlarmThreshhold)
- pixel = colorNfileAlarm.pixel;
- else if (((current_server -> file_max * 100) / current_server -> my_v -> v_file) > res.nfileWarningThreshhold)
- pixel = colorNfileWarning.pixel;
- else
- pixel = colorNfile.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> file_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
-
- if (file_percent > res.nfileAlarmThreshhold)
- pixel = colorNfileAlarm.pixel;
- else if (file_percent > res.nfileWarningThreshhold)
- pixel = colorNfileWarning.pixel;
- else
- pixel = colorNfile.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> file_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT, numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX, y,
- SP ->
- SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "f", 100, file_percent, pixel);
-
- /* Begin inode */
- /*
- XClearArea (display, window, x, y + FHEIGHT, FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + FHEIGHT, FWIDTH * 16, FHEIGHT);
-
-
- if (current_server -> inode_count > current_server -> inode_max)
- {
- current_server -> inode_max = current_server -> inode_count;
- }
-
- inode_percent = (current_server -> inode_count * 100) / current_server -> my_v -> v_inode;
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_inode);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + FHEIGHT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + FHEIGHT, numstr, 4);
-
- if (((current_server -> inode_max * 100) / current_server -> my_v -> v_inode) > res.ninodeAlarmThreshhold)
- pixel = colorNinodeAlarm.pixel;
- else if (((current_server -> inode_max * 100) / current_server -> my_v -> v_inode) > res.ninodeWarningThreshhold)
- pixel = colorNinodeWarning.pixel;
- else
- pixel = colorNinode.pixel;
-
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> inode_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + FHEIGHT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + FHEIGHT, numstr, 4);
-
- if (inode_percent > res.ninodeAlarmThreshhold)
- pixel = colorNinodeAlarm.pixel;
- else if (inode_percent > res.ninodeWarningThreshhold)
- pixel = colorNinodeWarning.pixel;
- else
- pixel = colorNinode.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> inode_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + FHEIGHT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + FHEIGHT, numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX,
- y + FHEIGHT,
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "i", 100, inode_percent, pixel);
-
- /* Begin proc */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 2), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 16, FHEIGHT);
-
-
-
- if (current_server -> proc_count > current_server -> proc_max)
- {
- current_server -> proc_max = current_server -> proc_count;
- }
-
- proc_percent = (current_server -> proc_count * 100) / current_server -> my_v -> v_proc;
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_proc);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 2), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 2), numstr, 4);
-
- if (((current_server -> proc_max * 100) / current_server -> my_v -> v_proc) > res.nprocAlarmThreshhold)
- pixel = colorNprocAlarm.pixel;
- else if (((current_server -> proc_max * 100) / current_server -> my_v -> v_proc) > res.nprocWarningThreshhold)
- pixel = colorNprocWarning.pixel;
- else
- pixel = colorNproc.pixel;
-
- XSetForeground (display, gc, pixel);
-
- sprintf (numstr, "%4ld", current_server -> proc_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 2), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 2), numstr, 4);
-
- if (proc_percent > res.nprocAlarmThreshhold)
- pixel = colorNprocAlarm.pixel;
- else if (proc_percent > res.nprocWarningThreshhold)
- pixel = colorNprocWarning.pixel;
- else
- pixel = colorNproc.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> proc_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 2), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 2), numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX,
- y + (FHEIGHT * 2),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "p", 100,
- proc_percent, pixel);
-
- /* Begin region */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 3), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 3), FWIDTH * 16, FHEIGHT
- );
-
- if (current_server -> region_count > current_server -> region_max)
- {
- current_server -> region_max = current_server -> region_count;
- }
-
- region_percent = (current_server -> region_count * 100) / current_server -> my_v -> v_region;
-
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_region);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 3), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 3), numstr, 4);
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- if (((current_server -> region_max * 100) / current_server -> my_v -> v_region) > res.nregionAlarmThreshhold)
- pixel = colorNregionAlarm.pixel;
- else if (((current_server -> region_max * 100) / current_server -> my_v -> v_region) > res.nregionWarningThreshhold)
- pixel = colorNregionWarning.pixel;
- else
- pixel = colorNregion.pixel;
-
- XSetForeground (display, gc, pixel);
-
- sprintf (numstr, "%4ld", current_server -> region_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 3), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 3), numstr, 4);
-
- if (region_percent > res.nregionAlarmThreshhold)
- pixel = colorNregionAlarm.pixel;
- else if (region_percent > res.nregionWarningThreshhold)
- pixel = colorNregionWarning.pixel;
- else
- pixel = colorNregion.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> region_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 3), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 3), numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX, y + (FHEIGHT * 3),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX), "r", 100,
- region_percent, pixel);
-
- /* Begin clist */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 4), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 4), FWIDTH * 16, FHEIGHT
- );
-
-
- if (current_server -> myclist > current_server -> myclist_max)
- {
- current_server -> myclist_max = current_server -> myclist;
- }
-
- myclist_percent = (current_server -> myclist * 100) / current_server -> my_v -> v_clist;
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_clist);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 4), numstr, 4);
-
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- if (((current_server -> myclist_max * 100) / current_server -> my_v -> v_clist) > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (((current_server -> myclist_max * 100) / current_server -> my_v -> v_clist) > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
-
- sprintf (numstr, "%4ld", current_server -> myclist_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 4), numstr, 4);
-
- if (myclist_percent > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (myclist_percent > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> myclist);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 4), numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX,
- y + (FHEIGHT * 4),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "c", 100, myclist_percent, pixel);
-
- /* Begin */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 4), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 5), FWIDTH * 16, FHEIGHT
- );
-
- #ifndef XSW32v5
- if (current_server -> callout_count > current_server -> callout_max)
- {
- current_server -> callout_max = current_server -> callout_count;
- }
-
- callout_percent = (current_server -> callout_count * 100) / current_server -> my_v -> v_call;
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_call);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 5), numstr, 4);
-
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- if (((current_server -> callout_max * 100) / current_server -> my_v -> v_call) > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (((current_server -> callout_max * 100) / current_server -> my_v -> v_call) > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
-
- sprintf (numstr, "%4ld", current_server -> callout_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 5), numstr, 4);
-
- if (callout_percent > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (callout_percent > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> callout_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 5), numstr, 4);
-
- #endif
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX,
- y + (FHEIGHT * 5),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "c", 100, callout_percent, pixel);
-
-
- /* Begin */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 6), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 6), FWIDTH * 16, FHEIGHT
- );
-
-
- if (current_server -> mount_count > current_server -> mount_max)
- {
- current_server -> mount_max = current_server -> mount_count;
- }
-
- mount_percent = (current_server -> mount_count * 100) / current_server -> my_v -> v_mount;
-
- XSetForeground (display, gc, colorStaticNumeric.pixel);
- sprintf (numstr, "%4ld", current_server -> my_v -> v_mount);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 4), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 6), numstr, 4);
-
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- if (((current_server -> mount_max * 100) / current_server -> my_v -> v_mount) > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (((current_server -> mount_max * 100) / current_server -> my_v -> v_mount) > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
-
- sprintf (numstr, "%4ld", current_server -> mount_max);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 6), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 6), numstr, 4);
-
- if (mount_percent > res.ncblocksAlarmThreshhold)
- pixel = colorNcblocksAlarm.pixel;
- else if (mount_percent > res.ncblocksWarningThreshhold)
- pixel = colorNcblocksWarning.pixel;
- else
- pixel = colorNcblocks.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", current_server -> mount_count);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 6), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 6), numstr, 4);
-
- update_Single_PctScale (
- window, display, gc, DrawAreaXYWH, pixmap,
- x + _FILESSCALE_SX,
- y + (FHEIGHT * 6),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_other].width - (x + _FILESSCALE_SX),
- "c", 100, mount_percent, pixel);
-
-
-
- } /* end of update_FilesScale */
-
- /*+-------------------------------------------------------------------------
- update_CacheScale(x,y)
-
- 000000000011111111112222222222333333333344444444445555555555666666
- 012345678901234567890123456789012345678901234567890123456789012345
- avg curr
- #### #### #### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- --------------------------------------------------------------------------*/
- void
- update_CacheScale (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_cache].pixmap;
-
- int x = 0;
- int y = FHEIGHT;
-
-
- unsigned long pixel;
- char numstr[8];
- char *cptr;
-
- long current_lwrite, current_bwrite;
- int percent_cache_write_hit;
- long current_lread, current_bread;
- int percent_cache_read_hit;
-
-
- #ifdef DEBUG2
- fprintf (stdout, "In update_CacheScale\n");
- #endif
- x += current_server -> PctScale_xoffset;
-
-
- /* Begin Cache Write */
- /*
- XClearArea (display, window, x, y, FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y, FWIDTH * 16, FHEIGHT);
-
- current_lwrite = sysidelta (lwrite);
- current_bwrite = sysidelta (bwrite);
-
- /* FACT : bwrite <= lwrite */
-
- if (current_lwrite != 0)
- {
- if (current_bwrite == current_lwrite)
- percent_cache_write_hit = 0;
- else if (current_bwrite > current_lwrite)
- percent_cache_write_hit = 100;
- else
- percent_cache_write_hit = (int) (
- (float) ((float) (current_lwrite - current_bwrite)
- / current_lwrite) * 100);
-
- current_server -> lwrite_cummulative = current_server -> my_sysinfo -> lwrite - current_server -> initial_lwrite;
- current_server -> bwrite_cummulative = current_server -> my_sysinfo -> bwrite - current_server -> initial_bwrite;
-
- current_server -> avg_percent_write = (int) (
- (float) ((float) (current_server -> lwrite_cummulative - current_server -> bwrite_cummulative)
- / current_server -> lwrite_cummulative) * 100);
-
- if (current_server -> avg_percent_write < res.writeCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (current_server -> avg_percent_write < res.writeCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- sprintf (numstr, "%4ld", current_server -> avg_percent_write);
- XSetForeground (display, gc, pixel);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
-
- if (percent_cache_write_hit < res.writeCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (percent_cache_write_hit < res.writeCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld", percent_cache_write_hit);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT, numstr, 4);
-
- if (percent_cache_write_hit < res.writeCacheAlarmThreshhold)
- pixel = colorCacheWriteMissAlarm.pixel;
- else if (percent_cache_write_hit < res.writeCacheWarningThreshhold)
- pixel = colorCacheWriteMissWarning.pixel;
- else
- pixel = colorCacheWriteMiss.pixel;
-
- update_Cache_PctScale (window, display, gc, DrawAreaXYWH,
- x + _FILESSCALE_SX, y,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width - (x + _FILESSCALE_SX),
- "H", 100, pixmap,
- percent_cache_write_hit,
- colorCacheWriteHit.pixel, pixel);
- }
- else
- {
- cptr = " ";
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT,
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT,
- cptr, strlen (cptr));
-
- if (current_server -> avg_percent_write < res.writeCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (current_server -> avg_percent_write < res.writeCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- sprintf (numstr, "%4ld", current_server -> avg_percent_write);
- XSetForeground (display, gc, pixel);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT, numstr, 4);
-
- XSetForeground (display, gc, colorNumeric.pixel);
- cptr = " N/A";
- /*
- XDrawString (display, window, gc, x + _FILESSCALE_CU,
- y + FASCENT, cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc, x + _FILESSCALE_CU,
- y + FASCENT, cptr, strlen (cptr));
- /*
- XClearArea (display, window,
- x + _FILESSCALE_SX, y - 1,
- DrawAreaXYWH.width, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x + _FILESSCALE_SX, y - 1,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width, FHEIGHT);
- }
-
-
- /* Begin Cache Read */
- /*
- XClearArea (display, window, x, y + (FHEIGHT * 1), FWIDTH * 16, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 1),
- FWIDTH * 16, FHEIGHT);
-
- current_lread = sysidelta (lread);
- current_bread = sysidelta (bread);
-
- if (current_lread != 0)
- {
- cptr = " ";
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 1),
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 1),
- cptr, strlen (cptr));
-
- if (current_bread == current_lread)
- percent_cache_read_hit = 0;
- else if (current_bread > current_lread)
- percent_cache_read_hit = 100;
- else
- percent_cache_read_hit = (int)
- ((float) ((float) (current_lread - current_bread) /
- current_lread) * 100);
-
- current_server -> lread_cummulative = current_server -> my_sysinfo -> lread - current_server -> initial_lread;
- current_server -> bread_cummulative = current_server -> my_sysinfo -> bread - current_server -> initial_bread;
-
- current_server -> avg_percent_read = (int)
- ((float) ((float) (current_server -> lread_cummulative - current_server -> bread_cummulative) / current_server -> lread_cummulative) * 100);
-
- if (current_server -> avg_percent_read < res.readCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (current_server -> avg_percent_read < res.readCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- sprintf (numstr, "%4ld", current_server -> avg_percent_read);
- XSetForeground (display, gc, pixel);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 1), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 1), numstr, 4);
-
- if (percent_cache_read_hit < res.readCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (percent_cache_read_hit < res.readCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- XSetForeground (display, gc, pixel);
- sprintf (numstr, "%4ld%", percent_cache_read_hit);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 1),
- numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CU, y + FASCENT + (FHEIGHT * 1),
- numstr, 4);
-
- if (percent_cache_read_hit < res.readCacheAlarmThreshhold)
- pixel = colorCacheReadMissAlarm.pixel;
- else if (percent_cache_read_hit < res.readCacheWarningThreshhold)
- pixel = colorCacheReadMissWarning.pixel;
- else
- pixel = colorCacheReadMiss.pixel;
-
- update_Cache_PctScale (
- window, display, gc, DrawAreaXYWH,
- x + _FILESSCALE_SX, y + (FHEIGHT * 1),
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width - (x + _FILESSCALE_SX),
- "H", 100, pixmap,
- percent_cache_read_hit,
- colorCacheReadHit.pixel, pixel);
- }
- else
- {
- cptr = " ";
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 1),
- cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_CF, y + FASCENT + (FHEIGHT * 1),
- cptr, strlen (cptr));
-
- if (current_server -> avg_percent_read < res.readCacheAlarmThreshhold)
- pixel = colorNumericAlarm.pixel;
- else if (current_server -> avg_percent_read < res.readCacheWarningThreshhold)
- pixel = colorNumericWarning.pixel;
- else
- pixel = colorNumeric.pixel;
-
- sprintf (numstr, "%4ld", current_server -> avg_percent_read);
- XSetForeground (display, gc, pixel);
- /*
- XDrawString (display, window, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 1), numstr, 4);
- */
- XDrawString (display, pixmap, gc,
- x + _FILESSCALE_MX, y + FASCENT + (FHEIGHT * 1), numstr, 4);
-
- XSetForeground (display, gc, colorNumeric.pixel);
- cptr = " N/A";
- /*
- XDrawString (display, window, gc, x + _FILESSCALE_CU,
- y + FASCENT + (FHEIGHT * 1), cptr, strlen (cptr));
- */
- XDrawString (display, pixmap, gc, x + _FILESSCALE_CU,
- y + FASCENT + (FHEIGHT * 1), cptr, strlen (cptr));
- /*
- XClearArea (display, window,
- x + _FILESSCALE_SX, y + (FHEIGHT * 1) - 1,
- DrawAreaXYWH.width, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x + _FILESSCALE_SX, y + (FHEIGHT * 1) - 1,
- current_server -> SEPERATE_WINDOWS_LIST[BUTTON_cache].width, FHEIGHT);
- }
-
-
- } /* end of update_CacheScale */
-
- #define _MEMCUR (FWIDTH * 1)
- #define _MEMSCALE (FWIDTH * 9)
- /*+-------------------------------------------------------------------------
- update_MemScale(x,y,per_state)
-
- 000000000011111111112222222222333333333344444444445555555555666666
- 012345678901234567890123456789012345678901234567890123456789012345
- tot usr ker brk
- ### ### ### ### xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- --------------------------------------------------------------------------*/
- void
- update_MemScale (SP)
- struct NetworkXswStruct *SP;
-
- {
- Window window = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].window;
- Display *display = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].display;
- GC gc = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].gc;
- XWindowAttributes DrawAreaXYWH = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].DrawAreaXYWH;
- Pixmap pixmap = SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].pixmap;
-
- int x = 0;
- int y = FHEIGHT;
-
- unsigned long Mempixel;
- unsigned long Swappixel;
- unsigned long AvailSwappixel;
-
- char numstr[9];
-
- int avg_percent_memory_used;
- int avg_percent_swap_used;
- int avg_percent_avail_swap_used;
-
- int percent_memory_used = 100 - (int) ((*current_server -> my_freemem * 100) / *current_server -> my_maxmem);
- int percent_swap_used = 100 - (int)
- ((current_server -> my_minfo -> freeswap * NBPSCTR / 1024) * 100) / current_server -> my_nswap;
- int percent_avail_swap_used =
- 100 - (int) (((*current_server -> my_availsmem * NBPP / 1024) * 100) /
- (current_server -> my_nswap + (*current_server -> my_maxmem * NBPP / 1024)));
-
- /* In case of long "roll over", re-initialize */
-
- if (((current_server -> cummulative_swap_used * 100) < 0) ||
- ((current_server -> cummulative_avail_swap * 100) < 0) ||
- ((current_server -> cummulative_memory_used * 100) < 0))
- {
- current_server -> cummulative_memory_used = *current_server -> my_freemem;
- current_server -> cummulative_swap_used = current_server -> my_minfo -> freeswap * NBPSCTR / 1024;
- current_server -> cummulative_avail_swap = *current_server -> my_availsmem;
- current_server -> memory_sample_count = 1;
-
- }
-
- avg_percent_memory_used = 100 - (int)
- ((current_server -> cummulative_memory_used * 100) / (current_server -> memory_sample_count * *current_server -> my_maxmem));
-
- avg_percent_swap_used = 100 - (int)
- (current_server -> cummulative_swap_used * 100) / (long) (current_server -> my_nswap * current_server -> memory_sample_count);
-
- avg_percent_avail_swap_used =
- 100 - (int) ((current_server -> cummulative_avail_swap * 100) /
- ((current_server -> my_nswap + (*current_server -> my_maxmem * NBPP / 1024)) * current_server -> memory_sample_count));
-
- if (percent_memory_used > res.memUsedAlarmThreshhold)
- Mempixel = colorMemUsedAlarm.pixel;
- else if (percent_memory_used > res.memUsedWarningThreshhold)
- Mempixel = colorMemUsedWarning.pixel;
- else
- Mempixel = colorMemUsed.pixel;
-
- x += (FWIDTH * 19);
-
- /*
- XClearArea (display, window, x, y, FWIDTH * 10, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y, FWIDTH * 10, FHEIGHT);
-
-
- XSetForeground (display, gc, Mempixel);
- sprintf (numstr, "%3d %3d", avg_percent_memory_used,
- percent_memory_used);
- /*
- XDrawString (display, window, gc,
- x + _MEMCUR, y + FASCENT, numstr, 8);
- */
- XDrawString (display, pixmap, gc,
- x + _MEMCUR, y + FASCENT, numstr, 8);
- /*
- XClearArea (display, window, x, y + FHEIGHT, FWIDTH * 10, FHEIGHT, 0);
- */
-
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + FHEIGHT, FWIDTH * 10, FHEIGHT);
-
- if (percent_swap_used > res.swapUsedAlarmThreshhold)
- Swappixel = colorSwapUsedAlarm.pixel;
- else if (percent_swap_used > res.swapUsedWarningThreshhold)
- Swappixel = colorSwapUsedWarning.pixel;
- else
- Swappixel = colorSwapUsed.pixel;
-
- XSetForeground (display, gc, Swappixel);
- sprintf (numstr, "%3d %3d", avg_percent_swap_used, percent_swap_used);
- /*
- XDrawString (display, window, gc,
- x + _MEMCUR, y + FASCENT + FHEIGHT, numstr, 8);
- */
- XDrawString (display, pixmap, gc,
- x + _MEMCUR, y + FASCENT + FHEIGHT, numstr, 8);
-
- /*
- XClearArea (display, window, x, y + (2 * FHEIGHT), FWIDTH * 10, FHEIGHT, 0);
- */
- XSetForeground (display, gc, background);
- XFillRectangle (display, pixmap, gc, x, y + (FHEIGHT * 2), FWIDTH * 10, FHEIGHT);
-
- if (avg_percent_avail_swap_used < 0)
- avg_percent_avail_swap_used = 0;
-
- if (percent_avail_swap_used < 0)
- percent_avail_swap_used = 0;
-
- if (percent_avail_swap_used > res.availSwapUsedAlarmThreshhold)
- AvailSwappixel = colorAvailSwapUsedAlarm.pixel;
- else if (percent_avail_swap_used > res.availSwapUsedWarningThreshhold)
- AvailSwappixel = colorAvailSwapUsedWarning.pixel;
- else
- AvailSwappixel = colorAvailSwapUsed.pixel;
-
- XSetForeground (display, gc, AvailSwappixel);
- sprintf (numstr, "%3d %3d", avg_percent_avail_swap_used,
- percent_avail_swap_used);
- /*
- XDrawString (display, window, gc,
- x + _MEMCUR, y + FASCENT + (2 * FHEIGHT), numstr, 8);
- */
- XDrawString (display, pixmap, gc,
- x + _MEMCUR, y + FASCENT + (2 * FHEIGHT), numstr, 8);
-
- XSetForeground (display, gc, colorNumeric.pixel);
-
- x += (FWIDTH * 1);
- update_Single_PctScale (window, display, gc, DrawAreaXYWH, pixmap,
- x + _MEMSCALE, y,
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width - (x + _MEMSCALE),
- "M", 100,
- percent_memory_used,
- Mempixel);
-
- update_Single_PctScale (window, display, gc, DrawAreaXYWH, pixmap,
- x + _MEMSCALE, y + FHEIGHT,
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width - (x + _MEMSCALE),
- "M", 100,
- percent_swap_used,
- Swappixel);
-
- update_Single_PctScale (window, display, gc, DrawAreaXYWH, pixmap,
- x + _MEMSCALE, y + (2 * FHEIGHT),
- SP -> SEPERATE_WINDOWS_LIST[BUTTON_mem].width - (x + _MEMSCALE),
- "M", 100,
- percent_avail_swap_used,
- AvailSwappixel);
-
- #ifdef DEBUG2
- fprintf (stdout, "leaving update_CpuScale\n");
- #endif
-
-
- } /* end of update_MemScale */
-
- /* vi: set tabstop=4 shiftwidth=4: */
- /* end of scales.c */
-